#ifndef _W25N_H_
#define _W25N_H_

/* Includes ----------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/* define ------------------------------------------------------------*/
#define W25Q_STATUS_BUSY    (1<<0)


#define W25Q_PAGE_SIZE  256
/* typedef -----------------------------------------------------------*/

enum W25QEarseType
{
    W25QEarse_Sector4K = 0,
    W25QEarse_Block32k,
    W25QEarse_Block64k,
    W25QEarse_Chip
};


/* macro -------------------------------------------------------------*/
#define W25Q_PowerDown()   W25Q_SendCmd(0xB9) 
/* variables ---------------------------------------------------------*/
/* function prototypes -----------------------------------------------*/
int W25Q_WritePage(uint32_t address, uint8_t *data, size_t length);
int W25Q_Write(uint32_t address, uint8_t *data, size_t length);
int W25Q_Erase(enum W25QEarseType earseType, uint32_t address);
int W25Q_Read(uint32_t address, uint8_t *data, size_t length);

int W25Q_SendCmd(uint8_t cmd);
int W25Q_SendCmdWithContent(uint8_t cmd, uint8_t *content, size_t length);
int W25Q_ReceiveCmd(uint8_t cmd, uint8_t *rx, size_t length);
int W25Q_ReceiveCmdArray(uint8_t *cmd, size_t cmdLength, uint8_t *rx, size_t length);

#endif
